package edu.umassd.raddacl.util;

import java.nio.file.Path;
import java.nio.file.Paths;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

@Component
public class Locations
{
	@Value("${dataset.output.dir}")
	private String outputLocation;

	@Value("${datasets.location}")
	private String dataSetLocation;

	private String name;

	private Path inputFile;
	private Path titleFile;
	private Path expectedFile;
	private Path outputFile;

	public void changeDataSet(String name)
	{
		this.name = name;

		inputFile = resource("inputs");
		titleFile = resource("titles");
		expectedFile = resource("expected");
		outputFile = artifact("output");
	}

	public Path getInputFile()
	{
		return inputFile;
	}

	public Path getTitleFile()
	{
		return titleFile;
	}

	public Path getExpectedFile()
	{
		return expectedFile;
	}

	public Path getOutputFile()
	{
		return outputFile;
	}

	private Path resource(String extension)
	{
		return FilesUtil.changeExtension(Paths.get(dataSetLocation, name),
				extension);
	}

	private Path artifact(String extension)
	{
		return FilesUtil.changeExtension(Paths.get(outputLocation, name),
				extension);
	}
}
